<template>
	<view>
		<uni-nav-bar left-icon="arrowthinleft" title="买单" :border="false" bg="bg-zhuse" color="#fff" @clickLeft="goBack()"></uni-nav-bar>
		<view class="flex align-center padding-y-30 padding-x-30 bg-fff" style="justify-content: space-between;">
			<view class="fs-30 color-999">付款给<text class="color-333 margin-left-24">{{info.name}}</text></view>
			<!-- <image :src="info.avatar" style="width: 100rpx;height: 100rpx;border-radius: 100%;"></image> -->
		</view>
		
		<view class="padding-x-30 margin-top-30">
			<view class="radius10 bg-fff padding-30">
				<view class="fs-30 color-000 fw-bold">买单金额</view>
				<view class="flex align-center margin-top-40 solid-bottom padding-bottom-30">
					<view class="fs-32 color-zhuse fw-bold margin-right-24">￥</view>
					<input type="text" v-model="money" placeholder="请输入金额" class="flex1 fs-32 color-zhuse">
				</view>
			</view>
		</view>
		<view class="padding-x-30 margin-top-120">
			<button class="public_btn" @tap="submit()">提交</button>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				info:{},
				shop_id:'',
				money:'',
			}
		},
		onLoad(opt) {
			// console.log(opt)
			this.shop_id = opt.shop_id;
			this.getInfo()
		},
		methods:{
			getInfo() {
				this.$api.shop_info({
					shop_id: this.shop_id
				}).then(res => {
					if (res.code == 1) {
						this.info = res.data
					}
				})
			},
			submit() {
				if (!this.money) {
					return this.$msg("请填写买单金额");
				}
				this.$api.offline_payment({
					to_member_id: this.shop_id,
					amount: this.money
				}).then(res => {
					if (res.code == 1) {
						uni.navigateTo({
							url: '/pages/canyin/pay?pay_amount=' + res.data.pay_amount + '&member_id=' +
								res.data.id + '&points=' + res.data.points + '&points_amount=' + res.data
								.points_amount
						})
					} else {
						this.$msg(res.msg)
					}
				})
			},
		}
	}
</script>

<style>
	page{background: #F7F7F7;}
</style>
<style lang="scss" scoped>
	.btn{width: 96%;margin: 150rpx auto 0;}
	.shadow{width: 100%;height: 100%;background: rgba(0,0,0,0.7);position: fixed;top: 0;left: 0;z-index: 9999;
		.con{width: 500rpx;border-radius: 12rpx;}
		.bot{border-top: 1rpx solid #f7f7f7;}
	}
</style>
